package com.ruoyi.common.core.utils.uuid;

import com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;

/**
 * 类描述:
 *
 * @author 31592
 * @date 2023-05-04 23:15
 */
public class IDhelper {
    //用mybatis-plus生成Long ID
    public static Long getNextId()
    {
        IdentifierGenerator identifierGenerator=new DefaultIdentifierGenerator();
        Number id=  identifierGenerator.nextId(new Object());
        Long nextid = Long.parseLong(id+"");
        return nextid;
    }

    public static void main(String[] args) {
        for(int i = 0;i<100;i++) {
            System.out.println(IdWorker.getId());
            System.out.println(IdWorker.getId());
        }
    }
}
